CPP=cl.exe
LINK=link.exe
OBJS_CORE=script.obj functions.obj compiler.obj evaluates.obj types.obj util.obj compiler_functions.obj
OBJS_SEQ=MidiDevice.obj MidiManager.obj MidiMsg.obj MidiMsgList.obj Project.obj Sequence.obj mn_assert.obj seq_functions.obj Environment.obj Track.obj WaveOutDevice.obj waveutil.obj WaveManager.obj Event.obj ProjectReader.obj ProjectWriter.obj
OBJS_EDITOR=editormain.obj initialize.obj editorutil.obj MainWindow.obj EditScreen.obj CommandScreen.obj EditCommand.obj EventScreen.obj wgdi.obj
PROJ=/nologo /EHsc /MT /Iseq /Igc /Iwave /Ivstplugin /Ieditor /I. /c /w
SCRIPT_PROGRAM=ravi.exe
EDITOR_PROGRAM=ravi_editor.exe
# PROJ=/nologo /MT /EHsc
# PROJ=/nologo /MT /W3 /Gm /EHsc /Zi /Od

all : $(SCRIPT_PROGRAM) $(EDITOR_PROGRAM)

clean : 
	-@erase script.obj
	-@erase functions.obj
	-@erase compiler.obj
	-@erase evaluates.obj
	-@erase types.obj
	-@erase MidiDevice.obj
	-@erase MidiManager.obj
	-@erase MidiMsg.obj
	-@erase MidiMsgList.obj
	-@erase Project.obj
	-@erase Sequence.obj
	-@erase mn_assert.obj
	-@erase seq_functions.obj
	-@erase Environment.obj
	-@erase Track.obj
	-@erase util.obj
	-@erase compiler_functions.obj
	-@erase waveutil.obj
	-@erase WaveOutDevice.obj
	-@erase WaveManager.obj
	-@erase scriptmain.obj
	-@erase editormain.obj
	-@erase initialize.obj
	-@erase editorutil.obj
	-@erase MainWindow.obj
	-@erase EditScreen.obj
	-@erase CommandScreen.obj
	-@erase EditCommand.obj
	-@erase Event.obj
	-@erase EventScreen.obj
	-@erase wgdi.obj
	-@erase ProjectReader.obj
	-@erase ProjectWriter.obj

ProjectWriter.obj : seq\ProjectWriter.h seq\ProjectWriter.cpp seq\Project.h seq\def.h seq\MidiException.h seq\Event.h seq\MidiMsg.h seq\EventContainer.h seq\Sequence.h
   $(CPP) $(PROJ) seq\ProjectWriter.cpp

ProjectReader.obj : seq\ProjectReader.h seq\ProjectReader.cpp seq\Project.h seq\def.h seq\MidiException.h seq\Event.h
   $(CPP) $(PROJ) seq\ProjectReader.cpp

wgdi.obj : editor\wgdi.h editor\wgdi.cpp
   $(CPP) $(PROJ) editor\wgdi.cpp

EventScreen.obj : editor\EventScreen.h editor\EventScreen.cpp editor\Screen.h editor\wgdi.h seq\Event.h editor\editorutil.h editor\screendef.h seq\Project.h seq\Sequence.h editor\EditCommand.h util.hpp
   $(CPP) $(PROJ) editor\EventScreen.cpp

Event.obj : seq\Event.h seq\Event.cpp seq\MidiMsg.h seq\EventContainer.h util.hpp seq\MidiException.h
   $(CPP) $(PROJ) seq\Event.cpp

EditCommand.obj : editor\EditCommand.h editor\EditCommand.cpp editor\MainWindow.h editor\EditorException.h seq\VisCommand.h seq\SeqCommand.h editor\Screen.h editor\EditScreen.h editor\EventScreen.h editor\screendef.h
   $(CPP) $(PROJ) editor\EditCommand.cpp

CommandScreen.obj : editor\CommandScreen.h editor\CommandScreen.cpp editor\Screen.h seq\Sequence.h editor\editorutil.h editor\wgdi.h compiler.hpp error.hpp
   $(CPP) $(PROJ) editor\CommandScreen.cpp

EditScreen.obj : editor\EditScreen.h editor\EditScreen.cpp editor\Screen.h seq\Sequence.h editor\wgdi.h seq\MidiManager.h editor\editorutil.h seq\EventContainer.h seq\Event.h seq\SeqCommand.h editor\EditorException.h editor\EditCommand.h
   $(CPP) $(PROJ) editor\EditScreen.cpp

editorutil.obj : editor\editorutil.h editor\editorutil.cpp
   $(CPP) $(PROJ) editor\editorutil.cpp

initialize.obj : editor\initialize.h editor\initialize.cpp editor\editorutil.h
   $(CPP) $(PROJ) editor\initialize.cpp

MainWindow.obj : editor\wgdi.h editor\MainWindow.h editor\MainWindow.cpp seq\VisCommand.h seq\Project.h seq\Sequence.h editor\initialize.h editor\editorutil.h editor\Layout.h editor\Screen.h editor\CommandScreen.h editor\EditScreen.h editor\EventScreen.h
   $(CPP) $(PROJ) editor\MainWindow.cpp

editormain.obj : editormain.cpp editor\MainWindow.h editor\initialize.h error.hpp compiler.hpp script.h
   $(CPP) $(PROJ) editormain.cpp

# ravi obj
WaveManager.obj : wave\WaveManager.h wave\WaveManager.cpp wave\WaveOutDevice.h wave\VstHost.h
   $(CPP) $(PROJ) wave\WaveManager.cpp seq\SyncObj.h

WaveOutDevice.obj : wave\WaveOutDevice.h wave\WaveOutDevice.cpp wave\wavedef.h
   $(CPP) $(PROJ) wave\WaveOutDevice.cpp

waveutil.obj : wave\waveutil.h wave\waveutil.cpp wave\wavedef.h
   $(CPP) $(PROJ) wave\waveutil.cpp

script.obj : script.cpp script.h error.hpp types.hpp functions.hpp evaluates.hpp seq_functions.hpp compiler.hpp compiler_functions.hpp
   $(CPP) $(PROJ) script.cpp

scriptmain.obj: scriptmain.cpp script.h error.hpp compiler.hpp
   $(CPP) $(PROJ) scriptmain.cpp

functions.obj : functions.cpp types.hpp error.hpp evaluates.hpp functions.hpp
   $(CPP) $(PROJ) functions.cpp

compiler.obj : compiler.cpp types.hpp compiler.hpp grammar.hpp evaluates.hpp error.hpp util.hpp
   $(CPP) $(PROJ) compiler.cpp

evaluates.obj : evaluates.cpp types.hpp error.hpp evaluates.hpp
   $(CPP) $(PROJ) evaluates.cpp

types.obj : types.cpp types.hpp
   $(CPP) $(PROJ) types.cpp

util.obj : util.cpp util.hpp
   $(CPP) $(PROJ) util.cpp

compiler_functions.obj : types.hpp error.hpp evaluates.hpp function_util.hpp compiler_functions.hpp compiler_functions.cpp compiler.hpp
   $(CPP) $(PROJ) compiler_functions.cpp

# seq obj
MidiDevice.obj : seq\MidiDevice.cpp seq\MidiDevice.h seq\MidiMsg.h seq\def.h
   $(CPP) $(PROJ) seq\MidiDevice.cpp

MidiManager.obj : seq\MidiManager.cpp seq\MidiManager.h seq\MidiException.h seq\raii.h seq\MidiMsgList.h seq\MidiDevice.h seq\def.h seq\SyncObj.h
   $(CPP) $(PROJ) seq\MidiManager.cpp

MidiMsg.obj : seq\MidiMsg.cpp seq\MidiMsg.h seq\def.h
   $(CPP) $(PROJ) seq\MidiMsg.cpp

MidiMsgList.obj : seq\MidiMsgList.cpp seq\MidiMsgList.h seq\MidiException.h seq\MidiMsg.h seq\def.h
   $(CPP) $(PROJ) seq\MidiMsgList.cpp

Environment.obj: seq\Environment.h seq\Environment.cpp wave\wavedef.h
   $(CPP) $(PROJ) seq\Environment.cpp

Track.obj: seq\Track.h seq\Track.cpp seq\def.h seq\MidiMsg.h seq\EventContainer.h seq\def.h
   $(CPP) $(PROJ) seq\Track.cpp

Project.obj : seq\Project.cpp seq\Project.h seq\MidiException.h seq\MidiManager.h seq\VisCommand.h seq\Environment.h seq\EventContainer.h seq\MidiMsg.h seq\def.h seq\Track.h seq\Event.h wave\WaveManager.h wave\VstHost.h
   $(CPP) $(PROJ) seq\Project.cpp

Sequence.obj : seq\Sequence.cpp seq\Sequence.h seq\MidiException.h seq\VisCommand.h seq\MidiManager.h seq\def.h seq\Environment.h seq\ProjectReader.h seq\ProjectWriter.h
   $(CPP) $(PROJ) seq\Sequence.cpp

mn_assert.obj : seq\mn_assert.cpp seq\mn_assert.h
   $(CPP) $(PROJ) seq\mn_assert.cpp

seq_functions.obj : seq_functions.cpp seq\def.h seq\MidiManager.h seq\Sequence.h seq\MidiException.h types.hpp error.hpp evaluates.hpp seq_functions.hpp function_util.hpp util.hpp seq\Environment.h
   $(CPP) $(PROJ) seq_functions.cpp

LINK_FLAG=gc.lib user32.lib winmm.lib gdi32.lib /NODEFAULTLIB:libc

$(SCRIPT_PROGRAM) : $(OBJS_CORE) $(OBJS_SEQ) scriptmain.obj
	$(LINK) $(LINK_FLAG) $(OBJS_CORE) $(OBJS_SEQ) scriptmain.obj /OUT:$(SCRIPT_PROGRAM)

$(EDITOR_PROGRAM) : $(OBJS_CORE) $(OBJS_SEQ) $(OBJS_EDITOR)
	$(LINK) $(LINK_FLAG) $(OBJS_CORE) $(OBJS_SEQ) $(OBJS_EDITOR) /OUT:$(EDITOR_PROGRAM)
